<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix" style="text-align: center;line-height: 30px">
        <h3>采购信息详情</h3>
      </div>
    <el-row>
      <el-col :span="12"><div class="grid-content bg-purple">
        <span>供应商名称:&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <span>{{providerName}}</span>
      </div></el-col>
      <el-col :span="12"><div class="grid-content bg-purple-light">
        <span>采购员:&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <span>{{buyPerson}}</span>
      </div></el-col>
    </el-row>
    <br>
    <el-row>
      <el-col :span="12"><div class="grid-content bg-purple">
        <span>采购时间:&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <span>{{buyTime}}</span>
      </div></el-col>
    </el-row>
    <br>
    <el-row>
      <el-col :span="12"><div class="grid-content bg-purple">
        <span>采购物品明细</span>
      </div></el-col>
    </el-row>
    <br>
    <el-row>
      <el-col :span="24"><div class="grid-content bg-purple">
        <el-table
            :data="buyListDtoList"
            stripe
            style="width: 100%">
          <el-table-column
              prop="goodsName"
              label="商品名称"
              width="175">
          </el-table-column>
          <el-table-column
              prop="goodsFactory"
              label="厂家"
              width="175">
          </el-table-column>
          <el-table-column
              prop="goodsAdviceBuyPrice"
              label="建议采购价"
              width="175">
          </el-table-column>
          <el-table-column
              prop="goodsAdviceSellPrice"
              label="建议销售价"
              width="175">
          </el-table-column>
          <el-table-column
              prop="number"
              label="采购数量"
              width="175">
          </el-table-column>
        </el-table>
      </div></el-col>
    </el-row>
    <br>
    <el-row>
      <el-col :span="24"><div class="grid-content bg-purple" style="text-align: center;line-height: 20px">
        <el-button type="primary" @click="onSubmit">确定</el-button>
      </div></el-col>
    </el-row>
    </el-card>
  </div>
</template>

<script>
export default {

  name: "BuyList",
  props: {
    buyId:Number
  },
  data(){
    return{
      providerName:'',
      buyEmployeeName:'',
      buyPerson:'',
      buyTime:'',
      buyListDtoList:[],
      buyDate:'',
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init(){

      let id = this.$store.state.buyId
      let url = "api/buy/findById?id="+id
      this.$axios.get(url).then(r=>{
        let datamsg = r.data
        console.log(datamsg)
        this.providerName = datamsg[0].providerName
        this.buyPerson = datamsg[0].buyEmployeeName
        this.buyTime = datamsg[0].buyDate
        this.buyListDtoList = datamsg
      })
    },
    onSubmit() {
      //调用父组件的关闭方法
      this.$router.push("PurchaseInfoView")
    }
  }
}
</script>

<style scoped>

</style>